package com.alks.function.mapper.procurement;

import com.alks.function.data.dto.procurement.CommonMaterialDetailDto;
import com.alks.function.data.dto.procurement.NotOrderDetailsDto;
import com.alks.function.data.request.procurement.NotOrderDetailsRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface SporadicClearanceMapper  {
    /*待定购明细查询*/
    List<NotOrderDetailsDto> getNotOrderDetailsList(@Param("companyId") String companyId, @Param("loginName") String loginName);

    /*待定购明细:修改*/
    int updateNotOrderDetails(@Param("companyId") String companyId, @Param("loginName") String loginName, @Param("request") List<NotOrderDetailsDto> request);

    /*选择通用材料：待请购批处理*/
    int pcReqTempAdd(@Param("request") List<CommonMaterialDetailDto> request, @Param("userName") String userName, @Param("loginName") String loginName, @Param("now") LocalDateTime now, @Param("companyId") String companyId);

    /*待定购明细item最大值*/
    @Select("SELECT MAX(ITEM) FROM PC_REQ_TEMP WHERE  COMPANY_ID = #{companyId} AND SYS_USER = #{loginName}")
    Integer getMaxNotOrderDetails(@Param("companyId") String companyId, @Param("loginName") String loginName);

    /*删除待定购明细*/
    int deleteNotOrderDetails(@Param("request") NotOrderDetailsRequest request, @Param("userName") String userName, @Param("loginName") String loginName, @Param("companyId") String companyId);

    /*批量删除*/
    int deleteBatchNotOrderDetails(@Param("request") List<NotOrderDetailsRequest> request, @Param("userName") String userName, @Param("loginName") String loginName, @Param("companyId") String companyId);
}
